<?php

require_once 'PHPUnit/Framework.php';

CCore::Using('mime.emails');

/**
 * Test class for CCoreMimeEmailCollection.
 */
class CCoreMimeEmailCollectionTest extends PHPUnit_Framework_TestCase
{
	/**
	 * @var CCoreMimeEmailCollection
	 */
	protected $object;

	/**
	 * This method is called before a test is executed.
	 */
	protected function setUp()
	{
		$this->object = new CCoreMimeEmailCollection(
			'test@exmaple.com, "Admin" <admin@example.com>, <new@exmaple.com> (With Rem)');
	}

	public function testConstruct0()
	{
		$this->assertEquals(3, $this->object->Count());
	}

	public function testConstruct1()
	{
		$this->object = new CCoreMimeEmailCollection('');
		$this->assertEquals(0, $this->object->Count());
	}

	public function testAdd()
	{
		$oMimeEmail = new CCoreMimeEmail('help@example.com');
		$this->object->Add($oMimeEmail);
		$this->assertEquals(4, $this->object->Count());
		
		$this->object->Clear();
		$this->assertEquals(0, $this->object->Count());
	}
}
